package top.chukongxiang.project.base.service.sys.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import top.chukongxiang.project.base.mapper.sys.MenuMapper;
import top.chukongxiang.project.base.model.entity.sys.Menu;
import top.chukongxiang.project.base.service.sys.MenuService;

import java.util.List;

/**
 * 菜单Service实现
 * @author 楚孔响
 * @version 1.0
 * @date 2022/2/18 15:25
 */
@Service
@Slf4j
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {
    @Override
    public List<Menu> listByParentId(Long parentId) {
        return list(Wrappers.<Menu>lambdaQuery()
                .eq(parentId != null, Menu::getParentId, parentId)
                .isNull(parentId == null, Menu::getParentId));
    }
}
